package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 店铺类型
 * @date : 2023/11/06 16:31
 */
@Getter
@AllArgsConstructor
public enum StoreTypeEnum {
    /**
     * 店铺类型：SPECIALTY-专卖店; CONVENIENCE-便利店
     */
    SPECIALTY(1, "专卖店"),
    CONVENIENCE(2, "便利店"),
    ;
    private final Integer code;
    private final String name;

    public static StoreTypeEnum getStoreSourceEnum(Integer code) {
        return Arrays.stream(StoreTypeEnum.values())
                .filter(sourceEnum -> Objects.nonNull(code) && sourceEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
